<html>

  <head>

    <meta name= "viewport" content= "width=device-width" http-equiv="Content-Type"/>
    <title>Let's make some water!</title>
    <link rel="icon" type="image.jpg" href="../../images/icon.png" />
    <link rel="stylesheet" href="../../styles.css" type="text/css">

  </head>

  <body>

    <div class="start">
      <div class="title">
        <h1>Let's make some water!</h1> 
      </div>
    </div>

    <div class="main">

      <div class="right">

        <h3>Index</h3>
        <hr>
        <p>1. <a href="../../index.html">Introduction</a></p>
        <p>2. <a href="../tutorials.html">Tutorials</a></p>
        <p>3. <a href="../resources.html">Resources</a></p>

      </div>

    <div class="left">

    <h2>Contents</h2>
    <hr>

				<p>1. <a href="#tools">Required tools</a></p>
				<p>2. <a href="#tutorials">Required tutorials</a></p>
				<p>3. <a href="#steps">Steps</a></p>

				<br>

    <hr id="tools">
    <h2>Required tools</h2>
    <hr>
    
      <p>Refer to the "Resources" section for download.</p>

      <p>- Blender</p>
      <p>- SuperBMD</p>
      <p>- j3dview</p>
      <p>- Any text editor you like (Notepad++ is recommended)</p>
      <p>- NeoKCLCreate</p>
      <p>- Arc Convertor</p>
      <p>- Whitehole</p>
      <p>- Wiimm's ISO Tools (to get your SMG1 dump)</p>

      <br>

    <hr id="tutorials">
    <h2>Required tutorials</h2>
    <hr>

      <p>- <a href="t4.html">Custom model with an animated in-game material</a></p>
      <p>- <a href="t5.html">Let's make some ice!</a></p>

      <br>

    <hr id="steps">
    <h2>Steps &emsp;&emsp;&emsp; &emsp;&emsp;&emsp; &emsp;&emsp;&emsp; &emsp;&emsp;&emsp; &emsp;&emsp;&emsp; files used: <a href="https://archive.org/download/humming-owl-storage/tutorial6.zip">tutorial6.zip</a></h2>
    <hr>

      <p>Just like the <b>last tutorial</b> (<a href="t5.html">Let's make some ice!</a>) I will show you how to make some <b>nice looking water</b>. The <b>water effect</b> that I am going to use here is found on <b>SMG1</b> on the <code>CocoTwinB</code> <b>object</b> from <code>EggStarGalaxy</code> (<b>Fig. 1</b>).</p>

      <img src="../../images/t6/Fig 1.jpg">
      <b><p class="idtext">(Fig. 1 - <code>CocoTwinB</code> object's water)</p></b>
      <br>

      <p>The <b>DAE file</b> created by <b>SuperBMD</b> after extracting the contents of the <b>BDL file</b> associated with the <code>CocoTwinB</code> <b>model</b> shows us that this <b>water effect</b> is composed by 3 objects (<b>Fig. 2</b>). The <b>materials</b> and <b>textures</b> for the <b>3 pieces</b> are:</p>

      <table>
        <tr>
          <td><b>Object</b></td>
          <td><b>Material</b></td>
          <td><b>Textures</b></td>
        </tr>
        <tr>
          <td>External (mesh-0)</td>
          <td>lambert30_v</td>
          <td>- Water_chrome0 <br> - Water_chrome0</td>
        </tr>
        <tr>
          <td>Intermediate (mesh-1)</td>
          <td>lambert27_v</td>
          <td>- grnd3</td>
        </tr>
        <tr>
          <td>Internal (mesh-2)</td>
          <td>lambert31_v</td>
          <td>- grnd3 <br> - Water_chrome0</td>
        </tr>
      </table>

      <br>

      <img src="../../images/t6/Fig 2.jpg">
      <b><p class="idtext">(Fig. 2 - <code>CocoTwinB</code>'s DAE file opened in Blender)</p></b>
      <br>

      <p>I’ve decided to make with <b>this effect</b> a little <b>water planet model</b>, just to show how this <b>water</b> looks like. I choose <b>3 UV spheres</b> on <b>Blender</b> (one inside another) and assigned the respective <b>materials</b> to each one of them, applied <b>Shade Smooth</b> and also the <b>Sphere Projection unwrap option to all spheres</b> (<b>Fig. 3</b>).</p>

      <img src="../../images/t6/Fig 3.jpg">
      <b><p class="idtext">(Fig. 3 - Custom model setup for the water effect)</p></b>
      <br>

      <p>From the <b>DAE file</b> we can see that one of the objects (<b>the internal one</b>) composing this <b>water effect</b> has some <b>blue vertex paint</b> (go to <b>Texture view</b>) (<b>Fig. 4</b>). I need that <b>vertex paint color</b> on the internal part of my <b>custom model</b>. To <b>transfer</b> <b>vertex paint</b> from an object to another of your choice you can to use the <b>Blender’s</b> <code>Data Transfer</code> <b>modifier</b>. The process in this case goes as follows:</p>

      <img src="../../images/t6/Fig 4.jpg">
      <b><p class="idtext">(Fig. 4 - Blue vertex paint on internal part of original DAE model)</p></b>
      <br>

      <p><b>1)</b> Import the <b>DAE file</b> of the original model to your <b>custom model project</b> and locate the desired part of it that has the <b>vertex paint</b> you want to transfer to your target <b>custom object</b> (<b>Fig. 5</b>) (<code>fig3</code> will receive the <b>vertex paint</b> of the <code>mesh-2</code> object from the <b>DAE file</b>). Delete the <code>skeleton_root</code> of the <b>DAE model</b> so you can move the model’s pieces more freely).</p>

      <img src="../../images/t6/Fig 5.jpg">
      <b><p class="idtext">(Fig. 5 - Original internal object imported in custom model project)</p></b>
      <br>

      <p><b>2)</b> Create a <b>Vertex Color</b> for your <b>target object</b> in the <b>Data tab</b> (press the <code>+</code> <b>button</b>, <b>Fig. 6</b>). You need to do this before using the <code>Data Transfer</code> <b>modifier</b>.</p>

      <img src="../../images/t6/Fig 6.jpg">
      <b><p class="idtext">(Fig. 6 - DAE internal object imported in custom model project)</p></b>
      <br>

      <p><b>3)</b> Create a <code>Data Transfer</code> <b>modifier</b> for your <b>target object</b>, select a <code>Source Object</code> for this <b>modifier</b> (the object from which you want to extract the <b>vertex paint</b>), in this case <code>mesh-2</code> (<b>Fig. 7a and 7b</b>), check the <code>Face Corner Data</code> <b>box</b>, select the <code>VCol</code> <b>option</b>, change the <code>All Layers</code> <b>option</b> at the right to the option related to the <code>mesh-2</code> object (in my case it is <code>meshId2-color0</code>) and change the <code>By name</code> <b>option</b> to the <code>Vertex Color</code> created for our <b>target object</b> from before, <code>Col</code> (<b>Fig. 7c</b>). Finally, <b>hit apply</b> and now you can delete the <code>mesh-2</code> object from the project.</p>

      <img src="../../images/t6/Fig 7a.jpg">
      <b><p class="idtext">(Fig. 7a - <code>Data Transfer</code> modifier)</p></b>
      <br>

      <img src="../../images/t6/Fig 7b.jpg">
      <b><p class="idtext">(Fig. 7b)</p></b>
      <br>

      <img src="../../images/t6/Fig 7c.jpg">
      <b><p class="idtext">(Fig. 7c)</p></b>
      <br>

      <hr>
      <p><b>NOTE 1:</b> it isn’t necessary to do this to all the objects of your model, I did it in this case because I just wanted some fast <b>blue vertex paint</b> to mimic the <b>DAE model water effect</b>. <b>Vertex paint</b> is something else that can be asigned to the faces of the objects that is not related to the <b>materials</b>.</p>

      <p><b>NOTE 2:</b> By changing the <b>position, scale and rotations</b> of the <code>Source Object</code> you can change how the <b>vertex paint</b> will be applied to the <b>target object</b>.</p>

      <p><b>NOTE 3:</b> If you add the <b>vertex paint</b> like this to your <b>custom models</b> using <b>in-game materials</b>, the converted model (<b>BMD/BDL</b>) will display correctly in <b>j3dview</b> and <b>Whitehole</b>. <b>Weight paint</b> also has this effect.</p>
      <hr>

      <br>

      <p>I exported the <b>vertex paint</b> from the remaining parts of the <b>DAE file</b> related to the parts of my <b>custom model</b> as well (just because I wanted to, <b>Fig. 8</b>).</p>

      <img src="../../images/t6/Fig 8.jpg">
      <b><p class="idtext">(Fig. 8 - Vertex paint on the custom model)</p></b>
      <br>

      <p>The <b>normals</b> for all objects of our custom model need be <b>facing outwards</b> for this <b>water effect</b>.</p>

      <p>After all that, you can export your model as and <b>FBX</b> (remember to <b>scale it</b>, <b>reset the models properties</b> with the <b>Ctrl + A</b> functions and <b>order the meshes by name</b> as in the <b>DAE model</b>) and convert it to <b>BMD</b> by using <b>SuperBMD</b>. You will have to use the <code>--nosort</code> <b>option</b> so that the <b>materials</b> on the model display correctly on <b>j3dview/game</b>. I don’t know yet how to explain how the sorting affects how the <b>materials</b> will show on game but always follow the order of meshes the <b>DAE file</b> has for <b>complex material effects</b>. Then, we can see the model on <b>j3dview</b> and finally on <b>game</b> (<b>Vid. 1, Fig. 9</b>).</p>

      <iframe id="embed" src="https://www.youtube.com/embed/siixfX6AZFU?si=_Wh0e6JgN-ZfW_7d" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>

      <b><p class="idtext">(Vid. 1 - Water planet model with its animation in j3dview)</p></b>
      <br>

      <img src="../../images/t6/Fig 9.jpg">
      <b><p class="idtext">(Fig. 9 - Mario standing on a new water planet)</p></b>
      <br>
      
      <hr>
      <p><b>NOTE 4:</b> Remember to include the <b>BTK file</b> of the original model on the <b>ARC file</b> of your <b>custom model</b> so that the <b>water gets its animation</b>!</p>

      <p><b>NOTE 5:</b> For this <b>custom model</b> to work in game as shown in <b>Fig. 9</b>, I used a <b>custom collision</b>, a <b>water area object</b> (spherical) and a <b>spherical gravitational field</b>. In future tutorials I will cover how to deal with those.</p>
      <hr>
      
      <br>

    </div>
    
    </div>

  </body>

</html>
